package com.yilong.wei.app.controller;

import com.yilong.wei.app.domain.MenuDO;
import com.yilong.wei.app.domain.Tree;
import com.yilong.wei.app.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class LoginController {

    @Autowired
    private MenuService menuService;

    @GetMapping({ "/" })
    String index(Model model) {
        List<Tree<MenuDO>> menus = menuService.listMenuTree(1L);
        model.addAttribute("menus", menus);
        return "index_v1";
    }
}
